<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改导航栏')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-nav-edit" th:object="${cmsNav}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">栏目名称：</label>
                <div class="col-sm-8">
                    <input name="name" th:field="*{name}" class="form-control" type="text" />
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">链接路径：</label>
                <div class="col-sm-8">
                    <input name="link" th:field="*{link}" class="form-control" type="text" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">链接类型：</label>
                <div class="col-sm-8">
                    <div class="radio-box">
                        <input type="radio" checked="" value="0"  name="linkType" th:field="*{linkType}"/>
                        <label>内部链接</label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" checked="" value="1"  name="linkType" th:field="*{linkType}"/>
                        <label>外部链接</label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">打开方式：</label>
                <div class="col-sm-8">
                    <div class="radio-box">
                        <input type="radio" checked="" value="0"  name="openType" th:field="*{openType}"/>
                        <label>当前窗口</label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" checked="" value="1"  name="openType" th:field="*{openType}" />
                        <label>新窗口</label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "info/nav";

        var icon = "<i class='fa fa-times-circle'></i> ";
        $('#form-nav-add').validate({
            focusCleanup: true,
            rules: {
                name: "required",
                link: "required"
            },
            messages: {
                name: icon + "必填项",
                link: icon + "必填项"
            }
        })

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-nav-edit').serialize());
            }
        }
    </script>
</body>
</html>